<%@ page language="java" import="java.util.*" pageEncoding="utf-8"
	isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String path = request.getContextPath();
			String basePath = request.getScheme() + "://"
					+ request.getServerName() + ":" + request.getServerPort()
					+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>

<script type="text/javascript" src="<%=request.getContextPath()%>/easyui/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/easyui/locale/easyui-lang-zh_CN.js"></script>
<link href="<%=request.getContextPath()%>/easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/easyui/themes/icon.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/jPages.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/animate.css">
<script src="<%=request.getContextPath()%>/js/jquery-1.8.2.min.js"></script>
<script src="<%=request.getContextPath()%>/js/jPages.js"></script>
<script type="text/javascript">
$(function(){  
	$("div.holder").jPages({  
	  containerID : "item", 
	  first:"首页", 
	  previous : "上一页",  
	  next : "下一页",
	  last:"尾页",  
	  perPage : 10,  
	  //delay : 100,
	  //动画效果
	  //animation:"bounceInLeft"
	});  
 });  
</script>
<script type="text/javascript">
$(document).ready(function(){
  $(".click").click(function(){
 	 $(".tip").fadeIn(200);
  });
  
  $(".sure").click(function(){
 	 $(".tip").fadeOut(100);
  });

  $(".cancel").click(function(){
	  $(".tip").fadeOut(100);
	  $(".jiefeng").fadeOut(100);
  });
});
</script>
</head>

<body>
	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><ema href="javascript:void">首页</em></li>
			<li><ema href="javascript:void">内容管理</em></li>
			<li><ema href="javascript:void">投诉管理</em></li>
		</ul>
	</div>
	<div class="rightinfo">
		<div class="tools">
			<form  style="    font-size: 16px;" action="<%=request.getContextPath()%>/selectComplaintList" method="post" name="serch">
				<td class="zi">提交时间：</td>
				<td><input type="date" name="startTime" style="    height: 20px; border:1px solid red;"/>至<input type="date" name="endTime" style=" height: 20px; border:1px solid red;"/></td>
				<td class="zi">状态：</td>
				<td><select name="is_acceptance" class="selector">
								<option selected="selected" value="">请选择状态</option>
								<option value="1">已受理</option>
								<option value="0">未受理</option>
						</select></td>
				<td class="zi">姓名：</td>
				<td><input type="text" id="staff_id" name="username" style="    height: 20px; border:1px solid red;"/></td>
				<td class="zi">手机号：</td>
				<td><input type="text" id="addres" name="mobile" style="    height: 20px;border:1px solid red;"/></td>
				<td class="zi">订单编号：</td>
				<td><input type="text" id="addres" name="order_id" style="    height: 20px;border:1px solid red;"/></td>
			
			<div class="toolbar1">
				<table>
					<tr style="border: 0px ">
						<td><input type="submit" value="查询" class="button" /></td>
					<!-- 	<td><input type="button" value="备份" class="button" id="backups"   /></td>
						<td><input type="button" value="恢复" class="button" id="recovery"  /></td> -->
					</tr>
				</table>
			</div>
			</form>
		</div>
		<table class="tablelist">
			<thead>
				<tr>
					<th>姓名</th>
					<th>手机号</th>
					<th>投诉内容</th>
					<th>投诉对象</th>
					<th>申诉内容</th>
					<th>订单号</th>
					<th>提交时间</th>
					<th>状态</th>
					<th>受理人</th>
					<th>受理内容</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody class="tb" id="item">
				<c:forEach items="${lists}" var="data">
					<tr>
						<td>${data.username} </td>
						<td>${data.mobile}</td>
						<td>${data.content}	</td>
						<td>${data.appeal_username}</td>
							<td>
						${data.appeal_content}
						</td>
						<td>${data.order_id}</td>
						<td>${data.create_time}
						</td>
						<td>
							${data.is_acceptance==0?'未受理':'已受理'}
						</td>
 						<td>${data.acceptance_username }</td>
 						<td>${data.acceptance_content }</td>
						<td>
							<ul class="toolbar"style=" margin-left: 49px;">
						<li style="width: 33px;"><a style=" margin-left: 9px;"href="<%=request.getContextPath()%>/selectComplaintList?id=${data.id}&acceptance=${data.is_acceptance}" >查看</a></li>
							<c:if test="${data.is_acceptance==0}">
							<li style="width: 33px;"><a style=" margin-left: 9px;" onclick="show(${data.appea_id+p},${data.id},this)">受理</a></li>
							<input type="hidden" id="orderId" name="orderId" value="${data.order_id}" />
							</c:if>
						<%-- <li style="margin-left: 20px; width: 93px;"><a style=" margin-left: 9px;"href="/htx-backer/selectCompanyList?userid=${data.id}" >通过审核</a></li> --%>
						</ul>
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		<div style="clear:both;"></div>
		<!-- 分页的页码 -->
		<div class="holder"></div>
		共${nums}条记录
		<div id="s" style="position:absolute;display:none; left:50%;top:50%;width:550px;height:350px;margin-left:-275px;margin-top:-175px;z-index:10;border:2px solid #ccc;background-color:#fff;">
    		<h4 style="font-size: 16px;background: #ccc;height: 40px;line-height: 40px;text-indent: 1.5em;">受理反馈</h4>
    		<div style="margin-bottom: 20px;">
    			<label style="display: inline-block;width: 75px;margin-left: 47px;">无责任方:</label>
    			<span style="display: inline-block;margin-top: 25px;"><input type="radio" name="radio"  style="vertical-align: bottom;margin-right: 5px;" value="0"/><b>需求方</b></span>
    			<span style="display: inline-block;margin-top: 25px;"><input type="radio" name="radio" style="vertical-align: bottom;margin-right: 5px;" value="1" /><b>服务方</b></span>
    		</div>
    		<div style="overflow:hidden">
    			<label style="float: left;width: 75px;margin-left: 47px;">反馈内容:</label>
    			<textarea style="width: 375px;height: 130px;border: 1px solid #ccc;float: left;resize:none;" id="connet"></textarea>
    		</div>
    		<div style="text-align: center;margin-top: 30px;">
    			<a style="border: 1px solid #ccc;padding: 8px 20px;border-radius: 5px;margin-right: 10px;display: inline-block;" onclick="quxiao()">取消</a>
    			<a style="border: 1px solid #ccc;padding: 8px 20px;border-radius: 5px;margin-right: 10px;display: inline-block;" onclick="save()">确定</a>
    		</div>
    	</div>
	</div>
	<div class="tip">
		<div class="tiptop">
			<span>提示信息</span>
		</div>
		<div class="tipinfo">
			<span><img src="<%=request.getContextPath()%>/images/ticon.png" /></span>
			<div class="tipright">
				<p>受理成功!</p>
				<cite>点击确定返回投诉列表 。</cite>
			</div>
		</div>
		<div class="tipbtn">
			<input name="" type="button" class="sure" onclick="cannel()"  value="确定"/>&nbsp;<input name="" type="button" class="cancel" value="取消" />
		</div>
	</div>
	<script type="text/javascript">
	console.log('${data.appea_id}');
	 $(".exportExcel").click(function(){
		 window.location.href = "<%=request.getContextPath()%>/enterpriseExportExcel";
	 })
	 
		$('.tablelist tbody tr:odd').addClass('odd');

	  function update(a){
		  var text = $(a).text();
		  var statu = "";
		  if(text == "封号"){
			  $(".tip").fadeIn(500);
			  statu = "0";
		  }else if(text == "解封"){
			  $(".jiefeng").fadeIn(500);
			  statu = "1";
		  }
		  $(".sure").click(function(){
			  var username = $(a).parent().parent().parent().parent().find("input[name=username]").val();
			var params = $(a).parent().parent().parent().parent().find("input[name=userid]").val()+ "," + statu + "," + username;;
			params+=",enter"; 
			window.location.href="<%=request.getContextPath()%>/updateUserStatu?params="+params;
	     });
	  }	
	  var shensu="";
	  var tousu="";
	  var orderId="";
	  function show(a,b,c){
	 		 $("#s").show();
	 		shensu=a;
	 		tousu=b;
	 		orderId=$(c).parent().parent().find("input[id=orderId]").val();
	 		
	 	}
		function quxiao(){
			 $("#s").hide();
		}
		function save(){
			var list= $('input:radio[name="radio"]:checked').val();
			if(list!=""){
				var id="";
				var type="";
				if(shensu==0){
					alert("没有申诉，不能受理服务方");	
					return;
				}
				if(list=='1'){
					id=shensu;
					type='1';
				}
				if(list=='0'){
					id=tousu;
					type='0';
				}
				if($("#connet").val()!=''){
					$.ajax({
	   	   				type:"post",
	   	   				url:"<%=request.getContextPath()%>/updateComplaint", 
	   	   				data:{
	   	   				acceptance_content:$("#connet").val(),
		   	   			id:id,
		   	   		type:type,
		   	   	orderId:orderId
	   	   				},
	   	   				dataType:"json",
	   	   				success:function(data){
	   	   					var flag = data.flag;
	   	   					if(flag == 1){
	   	   						$(".tip").fadeIn(200);
	   	   					}else if(flag == 3){
	   	   						$(".tip1").fadeIn(200);
	   	   					}
	   	   				}
	   				})
				}else{
					alert("反馈不能为空");	
				}
			}else{
				alert("请选择需求方和服务方");
			}
		}
		function cannel(){
	  		 window.location.href="<%=request.getContextPath()%>/selectComplaintList" ;
	  	}
		$("#backups").click(function(){
			  $.ajax({
	  				type:"get",
	  				url:"/htx-backer/backups", 
	  				data:{
	  					name:"appeal_complaint"
	  				},
	  				success:function(data){
	  					if(data == "OK"){
	  					 	alert("备份成功!");
	  					}else{
	  						alert("备份失败!");
	  					}
	  					
	  				}
				}) 
		 })
		  $("#recovery").click(function(){
			  $.ajax({
	  				type:"get",
	  				url:"/htx-backer/recovery", 
	  				data:{
	  					name:"appeal_complaint"
	  				},
	  				success:function(data){
	  					if(data == "OK"){
	  						var btn = confirm("恢复成功,点击确定刷新列表!")
	  					 	if(btn == true){
			   					window.location.href="<%=request.getContextPath()%>/selectComplaintList";
	  					 	}
	  					}else{
	  						alert("恢复失败!");
	  					}
	  				}
				}) 
		 })
	</script>
	
</body>
</html>
